package com.sinothk.gpserver.modules.biz.service.impl;

import com.sinothk.gpserver.modules.biz.entity.ScoreGroupMemberEntity;
import com.sinothk.gpserver.modules.biz.mapper.ScoreGroupMemberMapper;
import com.sinothk.gpserver.modules.biz.service.IScoreGroupMemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sinothk.server.support.entity.PageData;
import com.sinothk.server.support.entity.PageVo;

/**
 * <p>
 * 俱乐部用户积分 服务实现类
 * </p>
 *
 * @author Liang Y.t.
 * @since 2021-08-29
 */
@Service
public class ScoreGroupMemberServiceImpl extends ServiceImpl<ScoreGroupMemberMapper, ScoreGroupMemberEntity> implements IScoreGroupMemberService {

    @Resource
    private ScoreGroupMemberMapper scoreGroupMemberMapper;

    /**
     * 查询分页数据
     *
     * @param pageVo 分页参数
     * @return PageData
     */
    @Override
    public PageData<ScoreGroupMemberEntity> page(PageVo<ScoreGroupMemberEntity> pageVo) {
        Page<ScoreGroupMemberEntity> page = new Page<>(pageVo.getPageNum(), pageVo.getPageSize());
        Page<ScoreGroupMemberEntity> iPage = scoreGroupMemberMapper.selectPage(page, null);

        // 组装
        PageData<ScoreGroupMemberEntity> rspPageData = new PageData<>();
        rspPageData.setPageNum(iPage.getCurrent());
        rspPageData.setPageSize(iPage.getSize());
        rspPageData.setCurrent(iPage.getCurrent());
        rspPageData.setTotal(iPage.getTotal());
        rspPageData.setData(iPage.getRecords());

        return rspPageData;
    }

}
